package gla.centralhotel.business;

import gla.centralhotel.business.interfaces.IResourceBrowser;
import gla.centralhotel.dao.interfaces.ICountryDAO;
import gla.centralhotel.dao.interfaces.IHotelDAO;
import gla.centralhotel.dao.interfaces.IManagerDAO;
import gla.centralhotel.dao.interfaces.IPriceDAO;
import gla.centralhotel.dao.interfaces.IRoomBookingDAO;
import gla.centralhotel.dao.interfaces.IRoomDAO;
import gla.centralhotel.dao.interfaces.IRoomTypeDAO;
import gla.centralhotel.dao.interfaces.IZipcodeDAO;
import gla.centralhotel.exception.CollectionRetrieverException;
import gla.centralhotel.model.Agency;
import gla.centralhotel.model.Country;
import gla.centralhotel.model.Customer;
import gla.centralhotel.model.Hotel;
import gla.centralhotel.model.Manager;
import gla.centralhotel.model.Price;
import gla.centralhotel.model.Room;
import gla.centralhotel.model.RoomBooking;
import gla.centralhotel.model.RoomType;
import gla.centralhotel.model.Zipcode;
import java.util.ArrayList;
import javax.ejb.EJB;
import javax.ejb.Stateless;

/**
 *
 * @author loicpark
 */
@Stateless
public class ResourceBrowser implements IResourceBrowser {
    @EJB
    private IRoomTypeDAO roomTypeDAO;
    @EJB
    private IManagerDAO managerDAO;
    @EJB
    private IPriceDAO priceDAO;
    @EJB
    private IRoomBookingDAO roomBookingDAO;
    @EJB
    private IRoomDAO roomDAO;
    @EJB
    private IHotelDAO hotelDAO;
    @EJB
    private ICountryDAO countryDAO;
    @EJB
    private IZipcodeDAO zipcodeDAO;

    /**
     * Pour remplir la liste des zipcode au niveau uiweb
     * @return
     */
    
    public ArrayList<RoomType> getAllRoomType(){
        return roomTypeDAO.getAllRoomType();
    }
    public ArrayList<Zipcode> getAllZipcode() {
        return new ArrayList(zipcodeDAO.findAll());
    }

    public ArrayList<Country> getAllCountry() {
        return new ArrayList(countryDAO.findAll());
    }
    
    public ArrayList<RoomBooking> getAllRoomBookingByCustomer(Customer customer)throws CollectionRetrieverException{
        return roomBookingDAO.getAllRoomBookingByCustomer(customer);
    }

    public ArrayList<Hotel> getAllHotelByManager(Manager manager) throws CollectionRetrieverException {
        return hotelDAO.getAllHotelByManager(manager);
    }

    public ArrayList<Room> getAllRoomByType(RoomType type) throws CollectionRetrieverException {
        return roomDAO.getAllRoomByType(type);
    }

    public ArrayList<Room> getAllRoomByHotel(Hotel hotel) throws CollectionRetrieverException {
        return roomDAO.getAllRoomByHotel(hotel);
    }

    public ArrayList<Manager> getAllManagerByCountry(Country country) throws CollectionRetrieverException {
        return managerDAO.getAllManagerByCountry(country);
    }

    public ArrayList<Manager> getAllManagerByZipcode(Zipcode zipcode) throws CollectionRetrieverException {
        return managerDAO.getAllManagerByZipcode(zipcode);
    }

    public ArrayList<Price> getAllPriceByRoom(Room room) throws CollectionRetrieverException {
        return priceDAO.getAllPriceByRoom(room);
    }
    
    public ArrayList<Price> getAllPrice(){
        return new ArrayList(priceDAO.findAll());
    }

    public ArrayList<RoomBooking> getAllRoomBookingByAgency(Agency agency) throws CollectionRetrieverException {
        return roomBookingDAO.getAllRoomBookingByAgency(agency);
    }
    
    public ArrayList<RoomBooking> getAllRoomBookingByHotel(Hotel hotel) throws CollectionRetrieverException {
        return roomBookingDAO.getAllRoomBookingByHotel(hotel);
    }
}
